package com.dmjj.login.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Description: Swagger-UI 配置类 <br/>
 * Project: dmjj-saleback <br/>
 * ClassName: Swagger2Configurer <br/>
 * Copyright: Copyright (c) 2018 dmjj <br/>
 * @author lixiaofan <br/>
 * @version 1.0 2018年12月28日下午02:42:05 <br/>
 */
@Configuration
@EnableSwagger2
public class Swagger2Config {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.dmjj.login"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("DMJJ-售后服务 接口API文档")
                .description("API描述")
                .termsOfServiceUrl("http://localhost:8001/")
                .version("1.0")
                .build();
    }
}